home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / ISLEAP.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  614b  |  32 lines

  1. /*********
  2. * Function: ISLEAP
  3. * By: Tom Rettig
  4. * Modified by: Leonard Zerman
  5. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  6. *
  7. * Syntax: ISLEAP( <date> / <year> )
  8. * Return: True if <date> or <year> is a leap year, otherwise False
  9. ********/
  10.  
  11. #include "trlib.h"
  12.  
  13. TRTYPE isleap()
  14. {
  15.    char *ds;
  16.    int year;
  17.    if ( PCOUNT == 1 )
  18.    {
  19.       if ( ISDATE(1) )
  20.       {
  21.          ds = _pards(1);
  22.          year = DSYEAR(ds);
  23.          _retl( ISLPYR(year) );
  24.       }
  25.       else
  26.       if ( ISNUM(1) )
  27.          _retl( ISLPYR(_parni(1)) );
  28.    }
  29.    else
  30.       _retl( FALSE );
  31. }
  32.